#include "mainwindow.h"
#include "ui_mainwindow.h"
extern int rank;

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

//加法槽函数
void MainWindow::on_pushButton_1_clicked()  //加法等级1
{
    rank=1;
    this->hide();
    add_main = new add;
    connect(add_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_main->show();
}

void MainWindow::on_pushButton_2_clicked() //加法等级2
{
    rank=2;
    this->hide();
    add_main = new add;
    connect(add_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_main->show();
}

void MainWindow::on_pushButton_3_clicked() //加法等级3
{
    rank=3;
    this->hide();
    add_main = new add;
    connect(add_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_main->show();
}

//减法槽函数
void MainWindow::on_pushButton_4_clicked()  //减法等级1
{
    rank=1;
    this->hide();
    sub_main = new sub;
    connect(sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    sub_main->show();
}

void MainWindow::on_pushButton_5_clicked() //减法等级2
{
    rank=2;
    this->hide();
    sub_main = new sub;
    connect(sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    sub_main->show();
}

void MainWindow::on_pushButton_6_clicked() //减法等级3
{
    rank=3;
    this->hide();
    sub_main = new sub;
    connect(sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    sub_main->show();
}

//乘法槽函数
void MainWindow::on_pushButton_7_clicked()  //乘法等级1
{
    rank=1;
    this->hide();
    mul_main = new mul;
    connect(mul_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_main->show();
}

void MainWindow::on_pushButton_8_clicked() //乘法等级2
{
    rank=2;
    this->hide();
    mul_main = new mul;
    connect(mul_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_main->show();
}

void MainWindow::on_pushButton_9_clicked() //乘法等级3
{
    rank=3;
    this->hide();
    mul_main = new mul;
    connect(mul_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_main->show();
}

//除法槽函数
void MainWindow::on_pushButton_10_clicked()  //除法等级1
{
    rank=1;
    this->hide();
    div_main = new div_;
    connect(div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    div_main->show();
}

void MainWindow::on_pushButton_11_clicked() //除法等级2
{
    rank=2;
    this->hide();
    div_main = new div_;
    connect(div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    div_main->show();
}

void MainWindow::on_pushButton_12_clicked() //除法等级3
{
    rank=3;
    this->hide();
    div_main = new div_;
    connect(div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    div_main->show();
}

//加减混合槽函数
void MainWindow::on_pushButton_13_clicked()  //加减混合等级1
{
    rank=1;
    this->hide();
    add_sub_main = new add_sub;
    connect(add_sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_sub_main->show();
}

void MainWindow::on_pushButton_14_clicked() //加减混合等级2
{
    rank=2;
    this->hide();
    add_sub_main = new add_sub;
    connect(add_sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_sub_main->show();
}

void MainWindow::on_pushButton_15_clicked() //加减混合等级3
{
    rank=3;
    this->hide();
    add_sub_main = new add_sub;
    connect(add_sub_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    add_sub_main->show();
}

//乘除混合槽函数
void MainWindow::on_pushButton_16_clicked()  //乘除混合等级1
{
    rank=1;
    this->hide();
    mul_div_main = new mul_div;
    connect(mul_div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_div_main->show();
}

void MainWindow::on_pushButton_17_clicked() //乘除混合等级2
{
    rank=2;
    this->hide();
    mul_div_main = new mul_div;
    connect(mul_div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_div_main->show();
}

void MainWindow::on_pushButton_18_clicked() //乘除混合等级3
{
    rank=3;
    this->hide();
    mul_div_main = new mul_div;
    connect(mul_div_main, SIGNAL(sendsignal()),  this, SLOT(reshow()));
    mul_div_main->show();
}

void MainWindow::reshow(){
    this->show();
}
